// 用来放基本路由, 也用来导入本目录下的其他router, 简单项目直接调用mapper, 复杂的调用services
// https://github.com/KryptXBSA/t3-twitter-clone/blob/main/server/src/router/routes/userRouter/userRouter.ts
import { publicProcedure, router } from '~~/server/trpc/init'
import { createContext } from '~~/server/trpc/context'
import { byTest, addUserPojo, byTest2 } from './services'
import { getAllUsers } from './mappers'
import { z } from 'zod'

export const sysRouter = router({
    queryById: publicProcedure.input(z.string()).query(async ({ ctx, input }) => {
        return await byTest(input)
    }),
    queryById2: publicProcedure.input(z.string()).query(async ({ ctx, input }) => {
        return await byTest(input)
    }),
    getAllUsers: publicProcedure.query(async ({ ctx, input }) => {
        return await getAllUsers()
    }),
    addUser: publicProcedure.input(z.string()).mutation(async ({ ctx, input }) => {
        const id = await addUserPojo(input)
        return id
    }),
    test2: publicProcedure.input(z.string()).mutation(async ({ ctx, input }) => {
        const id = await byTest2()

        return id
    })


})
